package Server.ServerMainFrame.ServerMainFrameModel.ServerThread;

import java.io.*;
import java.net.*;
import Packet.*;

public class ReceivePacketThread extends Thread
{
	public ReceivePacketThread(ServerThread thread)
	{
		this.thread = thread;
	}

	public void run()
	{
		while (true)
		{
			try
			{
				Packet packet = (Packet)this.thread.getObjectInputStream().readObject();
				this.thread.dealPacket(packet);
			}
			catch(IOException exception)
			{
				exception.printStackTrace();
			}
			catch(ClassNotFoundException exception)
			{
				exception.printStackTrace();
			}
		}
	}

	private ServerThread thread;
}
